package WaiBao;

import java.util.Arrays;

public class WangYiBing {
    public static void main(String[] args) {
        String[] name = {"李晓宇(班长)", "王志文(副班长)", "小李(学习委员)", "李达康(体育委员)", "祁同伟", "田国富", "易学习", "肖钢玉", "赵德汉", "杜域名", "熊大", "熊二",
                "夕阳", "喜洋洋", "美羊羊", "懒洋洋", "那图鲁", "恩科", "王子敏", "林俊", "李朗", "白敬停", "黄训", "马自愿", "李浪", "马致远", "王宗辉", "王东",
                "俞敏洪", "王逸冰(学生)"};//考生本人:王逸冰(学生)
        int[] age = {22, 23, 19, 18, 19, 20, 18, 21, 19, 20, 18, 21, 18, 21, 20, 21, 19, 18, 18, 18, 19, 20, 20, 20, 20, 21, 21, 18, 21, 19};//考生年龄：19

        double[] shanxi1 = {71, 74, 81, 83, 76, 64, 71, 84, 80, 70, 74, 87, 85, 71, 74, 78, 61, 91, 92, 84, 73, 91, 75, 81, 78, 74, 82, 69, 68, 89};
        double[] shanxi2 = {61, 78, 85, 87, 84, 68, 74, 74, 73, 81, 87, 78, 87, 75, 85, 64, 71, 74, 77, 68, 82, 62, 65, 84, 74, 84, 74, 75, 77, 83};
        double[] shanxi3 = {79, 76, 75, 85, 78, 69, 70, 81, 84, 69, 63, 81, 85, 72, 68, 68, 84, 67, 66, 75, 92, 81, 91, 65, 79, 80, 79, 67, 78, 80};

        double shandong1;//代表每个学生的总分
        double shandong2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            shandong1 = shanxi1[i] +shanxi2[i] +shanxi3[i];
//            shandong2 = ( shandong1* 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + shandong1);
//            System.out.println(name[i] + "的平均分为:" +shandong2);
//        }

        double tianjing1 = 0,tianjing2 = 0;
        double[] dongbei = new double[30];
//        for (int i = 0; i < 30; i++) {
//            tianjing1 = shanxi1[i] + shanxi2[i] +shanxi3[i];
//            tianjing2 = (tianjing1 * 1.0) / 3;
//            dongbei[i] =tianjing2;
//        }
//
//        for (int i = 0; i <dongbei.length - 1; i++) {
//            for (int j = 0; j < dongbei.length - i - 1; j++) {
//                if (dongbei[j] < dongbei[j + 1]) {
//                    double tep = dongbei[j];
//                    dongbei[j] = dongbei[j + 1];
//                    dongbei[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(dongbei[i]);
//        }


        double anhui1 = 0,anhui2 = 0, anhui3 = 0;//计算每门课的平均分
        double hauinan1 = 0,hauinan2 = 0,hauinan3 = 0;//计算每门课标准差
        double wuhu1 = 0,wuhu2 = 0,wuhu3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i <shanxi1.length; i++) {
            sum2+=shanxi1[i];
        }
        anhui1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+anhui1);
        double Sum = 0;
        for (int i = 0; i <shanxi2.length; i++) {
            Sum+=shanxi2[i];
        }
        anhui2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+anhui2);
        double sum = 0;
        for (int i = 0; i <shanxi3.length; i++) {
            sum+=shanxi3[i];
        }
        anhui3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+anhui3);


//
        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <shanxi1.length; i++) {
            c1+= (shanxi1[i] -anhui1)*(shanxi1[i] -anhui1);
        }
        hauinan1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+hauinan1);

        for (int i = 0; i <shanxi2.length; i++) {
            c2+= (shanxi2[i] -anhui2)*(shanxi2[i] - anhui2);
        }
        hauinan2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+hauinan2);

        for (int i = 0; i <shanxi3.length; i++) {
            c3+= (shanxi3[i] - anhui3)*(shanxi3[i] -anhui3);
        }
        hauinan3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+hauinan3);
////////////////////
////////////////////
        Arrays.sort(shanxi1);
        Arrays.sort(shanxi2);
        Arrays.sort(shanxi3);
        wuhu1 =(shanxi1[14]+shanxi1[15])*1.0/2;
        wuhu2 =(shanxi2[14]+shanxi2[15])*1.0/2;
        wuhu3 =(shanxi3[14]+shanxi3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+wuhu1);
        System.out.println("微生物学的中位数为:"+wuhu2);
        System.out.println("人体组织解剖学的中位数为:"+wuhu3);



    }
}
